<template>
	<view>
		<view class="u-demo-wrap" style="background-color: #FFFFFF;">
			<view class="u-demo-area">
				<u-field v-model="mobile" label="新密码" :password="true" placeholder="请填写新密码">
				</u-field>
				<u-field v-model="code" :password="true" label="旧密码" placeholder="请填写旧密码">
				</u-field>
			</view>
			<button type="primary" @click="putmi">修改</button>
		</view>
	</view>
</template>

<script>
	import api from 'commer/apiURL.js'
	export default {
		data() {
			return {
				base: api.baseurl,
				mobile: '',
				code: ''
			}
		},
		methods: {
			putmi() {
				this.$put(this.base + '/prod-api/api/common/user/resetPwd', {
					"newPassword": this.mobile,
					"oldPassword": this.code
				}).then((res) => {
					if (res.code == 200) {
						uni.showToast({
							title: "修改成功",
						})
						setTimeout(() => {
							uni.switchTab({
								url: '../mine'
							})
						}, 500)
					} else {
						uni.showToast({
							title: res.msg,
							icon: 'none'
						})
					}
				})
			}
		}
	}
</script>

<style>

</style>
